native sscanf(const data[], const format[], {Float,_}:...);

#undef MAX_VEHICLES
#undef MAX_PLAYERS

/* Some settings, hopefully going to rp-config.pwn some good day */
#define SERVER_HOST "localhost"
#define SERVER_DB "arp"
#define SERVER_USER "root"
#define SERVER_PASSWORD ""


// Some settings
#define MAX_PLAYERS 100                          // KEEP IT AS LOW AS ITS POSSIBLE, SO ITS MORE EFFICENT
#define MAX_VEHICLES 1000                         // KEEP THIS AS LOW ITS POSSIBLE, SO ITS MORE EFFICENT
#define MAX_BUILDINGS 100
#define MAX_HOUSES 300
#define MAX_ZONE_NAME 28
#define MAX_DROPPED_WEAPONS 100
#define MAX_BUSINESSES 100
#define MAX_ITEMS 40
#define MAX_FACTIONS 40

#define ITEMS_BASEX 2552.7241
#define ITEMS_BASEY -2410.6599
#define ITEMS_BASEZ 13.6325

/* SHOP LISTS */

#define LIST_ELECTRONICS "Laptop\t\t\t{FFBF00}$200.00\n{FFFFFF}Walkie Talkie\t\t{FFBF00}$15.00\n{FFFFFF}Cellphone\t\t{FFBF00}$80.00\n{FFFFFF}GPS\t\t\t{FFBF00}$50.00"

/* Dialogs should be defined here */
#define DIALOG_LOGIN 2
#define DIALOG_REGISTER 1
#define DIALOG_CHAR 3
#define DIALOG_OPTIONS 4
#define DIALOG_CREATE_CHAR 5
#define DIALOG_DESC_CHAR 6
#define DIALOG_CREATE_SKIN 7
#define DIALOG_CREATE_AGE 8
#define DIALOG_SETTINGS 9
#define DIALOG_VEHICLE_RENT 10
#define DIALOG_CREATE_HOUSE 11
#define DIALOG_HOUSE_LEVEL 12
#define DIALOG_HOUSE_CONFIRM 13
#define DIALOG_BUSINESS_CONFIRM 14
#define DIALOG_WEAPON_SHOP 15
#define DIALOG_CLUB_SHOP 16
#define DIALOG_SHOP_STYLE 17
#define DIALOG_FIGHTING_STYLES 18
#define DIALOG_SHOP_SHOP 19
#define WEBSITE_DIALOG 20
#define INPUT_WEBSITE_DIALOG 21
#define DIALOG_SEND_EMAIL 22
#define LAPTOP_DIALOG 23
#define DIALOG_SHOW_EMAIL 24
#define DIALOG_GOTO_ADRESS 25
#define DIALOG_CREATE_WEB 26
#define DIALOG_WEB_CONTENT 27
#define DIALOG_WEB_EDIT 28
#define DIALOG_WEB_EDIT2 29
#define DIALOG_SEND_EMAIL_SUBJECT 30
#define DIALOG_SEND_EMAIL_BODY 31
#define DIALOG_SHOWING_EMAIL_BODY 32
#define DIALOG_SHOWING_EMAIL_OPTIONS 33
#define DIALOG_WEBSITE_LIST 34
#define DIALOG_FACTION_MENU 35
#define DIALOG_FACTION_INVITE 36
#define DIALOG_FACTION_INVITE_ACC 37
#define DIALOG_ELECTRONIC_SHOP 38
#define DIALOG_CONFIGURE_RADIO 39
#define DIALOG_GPS_MENU 40
#define DIALOG_PHONE_MENU 41
#define DIALOG_PHONE_CALL 42
#define DIALOG_PHONE_OPTION 43
#define DIALOG_CONTACTS_LIST 44
#define DIALOG_CONTACTS_ADD 45
#define DIALOG_CONTACTS_OPTION 46
#define DIALOG_CONTACTS_OPTION2 47
#define DIALOG_PHONE_SMS 48
#define DIALOG_PHONE_SMS2 49
#define DIALOG_PHONE_SMS3 50
#define DIALOG_CONTACTS_ADD2 51

/* Threads should be defined here */
#define THREAD_CHARS_MENU 1
#define LOGIN_MENU 2
#define THREAD_FIGHTINGSTYLE 3
#define THREAD_EMAILS 4
#define THREAD_WEBSITE_LIST 5
#define THREAD_SHOW_WEB 6
#define THREAD_EDIT_WEB 7
#define THREAD_GPS_SHOW 8
#define THREAD_SHOW_LOCATION 9
#define THREAD_CONTACTS_LIST 10

/* Colors */
#define COLOR_BLACK         0x000000FF
#define COLOR_GREY 			0xAFAFAFAA
#define COLOR_GREEN 		0x33AA33AA
#define COLOR_RED 			0xFF0000AA//0xAA3333AA
#define COLOR_LIGHTRED 		0xFF6347AA
#define COLOR_LIGHTBLUE 	0x33CCFFAA
#define COLOR_LIGHTGREEN 	0x9ACD32AA
#define COLOR_YELLOW 		0xFFFF00AA
#define COLOR_YELLOW2 		0xF5DEB3AA
#define COLOR_WHITE 		0xFFFFFFAA
#define COLOR_ME            0x83bfbfAA

#define COL_EASY           "{FFF1AF}"
#define COL_WHITE          "{FFFFFF}"
#define COL_BLACK          "{0E0101}"
#define COL_GREY           "{C3C3C3}"
#define COL_GREEN          "{6EF83C}"
#define COL_RED            "{F81414}"
#define COL_YELLOW         "{F3FF02}"
#define COL_ORANGE         "{FFAF00}"
#define COL_LIME           "{B7FF00}"
#define COL_CYAN           "{00FFEE}"
#define COL_LIGHTBLUE      "{00C0FF}"
#define COL_BLUE           "{0049FF}"
#define COL_MAGENTA        "{F300FF}"
#define COL_VIOLET         "{B700FF}"
#define COL_PINK           "{FF00EA}"
#define COL_MARONE         "{A90202}"
#define COL_CMD            "{B8FF02}"
#define COL_PARAM          "{3FCD02}"
#define COL_SERVER         "{AFE7FF}"
#define COL_VALUE          "{A3E4FF}"
#define COL_RULE           "{F9E8B7}"
#define COL_RULE2          "{FBDF89}"
#define COL_RWHITE         "{FFFFFF}"
#define COL_LGREEN         "{C9FFAB}"
#define COL_LRED           "{FFA1A1}"
#define COL_LRED2          "{C77D87}"

/* G-sTyLeZzZ' MySQL plugin */
#define mysql_fetch_row(%1) mysql_fetch_row_format(%1,"|")
#define mysql_next_row() mysql_retrieve_row()
#define mysql_get_field(%1,%2) mysql_fetch_field_row(%2,%1)

native mysql_affected_rows(connectionHandle = 1);
native mysql_close(connectionHandle = 1);
native mysql_connect(const host[],const user[],const database[],const password[]);
native mysql_debug(enable = 1);
native mysql_errno(connectionHandle = 1);
native mysql_fetch_int(connectionHandle = 1);
native mysql_fetch_field(number,dest[],connectionHandle = 1);
native mysql_fetch_field_row(string[],const fieldname[],connectionHandle = 1);
native mysql_fetch_float(&Float:result,connectionHandle = 1);
native mysql_fetch_row_format(string[],const delimiter[] = "|",connectionHandle = 1);
native mysql_field_count(connectionHandle = 1);
native mysql_free_result(connectionHandle = 1);
native mysql_get_charset(destination[],connectionHandle = 1);
native mysql_insert_id(connectionHandle = 1);
native mysql_num_rows(connectionHandle = 1);
native mysql_num_fields(connectionHandle = 1);
native mysql_ping(connectionHandle = 1);
native mysql_query(query[],resultid = (-1),extraid = (-1),connectionHandle = 1);
native mysql_query_callback(index,query[],callback[],extraid = (-1),connectionHandle = 1);
native mysql_real_escape_string(const source[],destination[],connectionHandle = 1);
native mysql_reconnect(connectionHandle = 1);
native mysql_reload(connectionHandle = 1);
native mysql_retrieve_row(connectionHandle = 1);
native mysql_set_charset(charset[],connectionHandle = 1);
native mysql_stat(const destination[],connectionHandle = 1);
native mysql_store_result(connectionHandle = 1);
native mysql_warning_count(connectionHandle = 1);

forward OnQueryFinish(finished_query[], resultid, extraid, connectionHandle);
forward OnQueryError(errorid, error[], resultid, extraid, callback[], errored_query[], connectionHandle);
forward SendLocalMessage(playerid, msg[], Float:MessageRange, color);

// Speed Cap by g_Slice
forward SetPlayerSpeedCap( playerid, Float:value );
forward DisablePlayerSpeedCap( playerid );



// OTHER
#define SendFormattedMessage(%0,%1,%2) do{new _str[128]; format(_str,128,%2); SendClientMessage(%0,%1,_str);}while(FALSE)

new  minute, second,
	day, month, year;
#pragma unused month
new Float:POS[4];


new
    query[256],
	str[256],
	tmp[256],
	line[512],
	PlayerName[24],
	Text3D:NickLabel[MAX_PLAYERS],
	Text3D:BuyableVehicle[MAX_VEHICLES],
	Text:VehicleCPU[MAX_PLAYERS],
	Text:Speedo[MAX_PLAYERS],
	Float:g_fSpeedCap[ MAX_PLAYERS ] = { 0.0, ... },
	logscr[MAX_PLAYERS],
	Text:InfoBar[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...},
	Float:Camera[MAX_PLAYERS],
	Text:InfoText[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...},
	Text:Tip = Text:INVALID_TEXT_DRAW,
	Text:Textdraw0[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...},
	Text:Textdraw1[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...},
	Text:Textdraw2[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...},
	Text:Textdraw3[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...},
	Text:Textdraw4[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...},
	Text:Textdraw5[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...},
    Text:SpeedHud[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...},
    Text:VehName[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...},
	Text:HouseTitle[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...},
	Text:HouseMenu[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...},
    Text:Clock = Text:INVALID_TEXT_DRAW;


new bool:gHasCharacters[MAX_PLAYERS char];
new bool:pLogged[MAX_PLAYERS char];

enum fInfo
{
	fid,
	fwage,
	fbank,
	fname[40],
	ftype,
	fowner
};
new FactionInfo[MAX_FACTIONS][fInfo];

enum wInfo
{
    Float:wPos[3],
    wObject,
    wDropped,
    wObjectID,
    wAmmo,
};
new WeaponInfo[MAX_DROPPED_WEAPONS][wInfo];

enum vInfo
{
    vSQLID,
    bool:isTrailer,
    Fuel,
    vModel,
    Float:vPos[4],
    vcolor1,
    vcolor2,
    vprice,
    vrent,
    vbuyable,
    vfaction,
    vOwner,
    vLock,
    vHotwired,
    vEngine,
    vMod[17],
	vPlate[30],
	vfuel,
	vRented,
}


new VehicleInfo[MAX_VEHICLES][vInfo];

enum buildInfo
{
    bbName[35],
    Float:bbPos[3],
    bbInterior,
    bbSQLID
}


new BuildingInfo[MAX_BUILDINGS][buildInfo];

enum acData
{
	pSQLID, // Player's sqlid
	cSQLID,
	cRented,
	pRank,
	pFaction,
	pPay,
	pPaycheck,
	pNumber,
	pRadio
};
new PlayerInfo[MAX_PLAYERS][acData];

enum bInfo
{
    bid,
    bowner,
    bbuyable,
    bprice,
    bname[64],
    btype,
    Float:bcoords[3],
    block,
    binterior,
    bbank
};
new BusinessInfo[MAX_BUSINESSES][bInfo];

enum hInfo
{
    hsqlid,
    hSQLIDowner,
    hSellable,
    hSell,
    hRent,
    hLevel,
    hPickup,
    Float:hExitX,
    Float:hExitY,
    Float:hExitZ,
    hVirtualWorld,
    hLocked,
    hStatus
};
new HouseInfo[MAX_HOUSES][hInfo];

Itter_Create(Vehicles, MAX_VEHICLES);
Itter_Create(Buildings, MAX_BUILDINGS);
Itter_Create(House,MAX_HOUSES);
Itter_Create(Weapons, MAX_DROPPED_WEAPONS);
Itter_Create(Businesses, MAX_BUSINESSES);
Itter_Create(Factions, MAX_FACTIONS);

new spoiler[20][0] =
{
    {1000},
    {1001},
    {1002},
    {1003},
    {1014},
    {1015},
    {1016},
    {1023},
    {1058},
    {1060},
    {1049},
    {1050},
    {1138},
    {1139},
    {1146},
    {1147},
    {1158},
    {1162},
    {1163},
    {1164}
};

new nitro[3][0] =
{
    {1008},
    {1009},
    {1010}
};

new fbumper[23][0] =
{
    {1117},
    {1152},
    {1153},
    {1155},
    {1157},
    {1160},
    {1165},
    {1167},
    {1169},
    {1170},
    {1171},
    {1172},
    {1173},
    {1174},
    {1175},
    {1179},
    {1181},
    {1182},
    {1185},
    {1188},
    {1189},
    {1192},
    {1193}
};

new rbumper[22][0] =
{
    {1140},
    {1141},
    {1148},
    {1149},
    {1150},
    {1151},
    {1154},
    {1156},
    {1159},
    {1161},
    {1166},
    {1168},
    {1176},
    {1177},
    {1178},
    {1180},
    {1183},
    {1184},
    {1186},
    {1187},
    {1190},
    {1191}
};

new exhaust[28][0] =
{
    {1018},
    {1019},
    {1020},
    {1021},
    {1022},
    {1028},
    {1029},
    {1037},
    {1043},
    {1044},
    {1045},
    {1046},
    {1059},
    {1064},
    {1065},
    {1066},
    {1089},
    {1092},
    {1104},
    {1105},
    {1113},
    {1114},
    {1126},
    {1127},
    {1129},
    {1132},
    {1135},
    {1136}
};

new bventr[2][0] =
{
    {1142},
    {1144}
};

new bventl[2][0] =
{
    {1143},
    {1145}
};

new bscoop[4][0] =
{
    {1004},
    {1005},
    {1011},
    {1012}
};

new rscoop[17][0] =
{
    {1006},
    {1032},
    {1033},
    {1035},
    {1038},
    {1053},
    {1054},
    {1055},
    {1061},
    {1067},
    {1068},
    {1088},
    {1091},
    {1103},
    {1128},
    {1130},
    {1131}
};

new lskirt[21][0] =
{
    {1007},
    {1026},
    {1031},
    {1036},
    {1039},
    {1042},
    {1047},
    {1048},
    {1056},
    {1057},
    {1069},
    {1070},
    {1090},
    {1093},
    {1106},
    {1108},
    {1118},
    {1119},
    {1133},
    {1122},
    {1134}
};

new rskirt[21][0] =
{
    {1017},
    {1027},
    {1030},
    {1040},
    {1041},
    {1051},
    {1052},
    {1062},
    {1063},
    {1071},
    {1072},
    {1094},
    {1095},
    {1099},
    {1101},
    {1102},
    {1107},
    {1120},
    {1121},
    {1124},
    {1137}
};

new hydraulics[1][0] =
{
    {1087}
};

new base[1][0] =
{
    {1086}
};

new rbbars[4][0] =
{
    {1109},
    {1110},
    {1123},
    {1125}
};

new fbbars[2][0] =
{
    {1115},
    {1116}
};

new wheels[17][0] =
{
    {1025},
    {1073},
    {1074},
    {1075},
    {1076},
    {1077},
    {1078},
    {1079},
    {1080},
    {1081},
    {1082},
    {1083},
    {1084},
    {1085},
    {1096},
    {1097},
    {1098}
};

new lights[2][0] =
{
    {1013},
    {1024}
};

new VehicleNames[][] =
{
    "Landstalker","Bravura","Buffalo","Linerunner","Pereniel","Sentinel","Dumper","Firetruck","Trashmaster","Stretch","Manana","Infernus","Voodoo","Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam","Esperanto",
    "Taxi","Washington","Bobcat","Mr Whoopee","BF Injection","Hunter","Premier","Enforcer","Securicar","Banshee","Predator","Bus","Rhino","Barracks","Hotknife","Trailer","Previon","Coach","Cabbie","Stallion",
    "Rumpo","RC Bandit","Romero","Packer","Monster","Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Trailer","Turismo","Speeder","Reefer","Tropic","Flatbed","Yankee","Caddy","Solair","Berkley's RC Van",
    "Skimmer","PCJ-600","Faggio","Freeway","RC Baron","RC Raider","Glendale","Oceanic","Sanchez","Sparrow","Patriot","Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler","ZR3 50","Walton","Regina",
    "Comet","BMX","Burrito","Camper","Marquis","Baggage","Dozer","Maverick","News Chopper","Rancher","FBI Rancher","Virgo","Greenwood","Jetmax","Hotring","Sandking","Blista Compact","Police Maverick","Boxville","Benson",
    "Mesa","RC Goblin","Hotring Racer","Hotring Racer","Bloodring Banger","Rancher","Super GT","Elegant","Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","RoadTrain","Nebula","Majestic","Buccaneer","Shamal",
    "Hydra","FCR-900","NRG-500","HPV1000","Cement Truck","Tow Truck","Fortune","Cadrona","FBI Truck","Willard","Forklift","Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight","Streak","Vortex",
    "Vincent","Bullet","Clover","Sadler","Firetruck","Hustler","Intruder","Primo","Cargobob","Tampa","Sunrise","Merit","Utility","Nevada","Yosemite","Windsor","Monster","Monster","Uranus","Jester",
    "Sultan","Stratum","Elegy","Raindance","RC Tiger","Flash","Tahoma","Savanna","Bandito","Freight","Trailer","Kart","Mower","Duneride","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley",
    "Stafford","BF-400","Newsvan","Tug","Trailer","Emperor","Wayfarer","Euros","Hotdog","Club","Trailer","Trailer","Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)","Police Car (SFPD)","Police Car (LVPD)","Police Ranger",
    "Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler","Luggage Trailer","Luggage Trailer","Stair Trailer","Boxville","Farm Plow","Utility Trailer"
};

new     Letters[][] =
{
    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
    "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
    "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
};


new WeaponNames[0][46] =
{
    {"Fists",},
    {"Brass Knuckles",},
    {"Golf Club",},
    {"Nite Stick",},
    {"Knife",},
    {"Baseball Bat",},
    {"Shovel",},
    {"Pool Cue",},
    {"Katana",},
    {"Chainsaw",},
    {"Purple Dildo",},
    {"Small White Vibrator",},
    {"Large White Vibrator",},
    {"Silver Vibrator",},
    {"Flowers",},
    {"Cane",},
    {"Grenade",},
    {"Tear Gas",},
    {"Molotov Cocktail",},
    {"None",},
    {"None",},
    {"None",},
    {"9mm",},
    {"Silenced 9mm",},
    {"Desert Eagle",},
    {"Shotgun",},
    {"Sawn-off Shotgun",},
    {"Combat Shotgun",},
    {"Micro SMG",},
    {"MP5",},
    {"AK-47",},
    {"M4",},
    {"Tec9",},
    {"Country Rifle",},
    {"Sniper Rifle",},
    {"Rocket Launcher",},
    {"HS Rocket Launcher",},
    {"Flamethrower",},
    {"Minigun",},
    {"Satchel Charge",},
    {"Detonator",},
    {"Spraycan",},
    {"Fire Extinguisher",},
    {"Camera",},
    {"Nightvision Goggles",},
    {"Thermal Goggles",},
    {"Parachute",}
};

new GunObjects[47][0] =                           // (c) gimini
{
    {                                             // Emty
        0
    },
    {                                             // Brass Knuckles
        331
    },
    {                                             // Golf Club
        333
    },
    {                                             // Nitestick
        334
    },
    {                                             // Knife
        335
    },
    {                                             // Baseball Bat
        336
    },
    {                                             // Showel
        337
    },
    {                                             // Pool Cue
        338
    },
    {                                             // Katana
        339
    },
    {                                             // Chainsaw
        341
    },
    {                                             // Purple Dildo
        321
    },
    {                                             // Small White Dildo
        322
    },
    {                                             // Long White Dildo
        323
    },
    {                                             // Vibrator
        324
    },
    {                                             // Flowers
        325
    },
    {                                             // Cane
        326
    },
    {                                             // Grenade
        342
    },
    {                                             // Tear Gas
        343
    },
    {                                             // Molotov
        344
    },
    {0},
    {0},
    {0},
    {                                             // Glock
        346
    },
    {                                             // Silenced Colt
        347
    },
    {                                             // Desert Eagle
        348
    },
    {                                             // Shotgun
        349
    },
    {                                             // Sawn Off
        350
    },
    {                                             // Combat Shotgun
        351
    },
    {                                             // Micro UZI
        352
    },
    {                                             // MP5
        353
    },
    {                                             // AK47
        355
    },
    {                                             // M4
        356
    },
    {                                             // Tec9
        372
    },
    {                                             // Rifle
        357
    },
    {                                             // Sniper Rifle
        358
    },
    {                                             // Rocket Launcher
        359
    },
    {                                             // HS Rocket Launcher
        360
    },
    {                                             // Flamethrower
        361
    },
    {                                             // Minigun
        362
    },
    {                                             // Detonator
        363
    },
    {                                             // Detonator Button
        364
    },
    {                                             // Spraycan
        365
    },
    {                                             // Fire Extinguisher
        366
    },
    {                                             // Camera
        367
    },
    {                                             // Nightvision
        368
    },
    {                                             // Infrared Vision
        368
    },
    {                                             // Parachute
        371
    }
};


forward OnPlayerHitBuildingEntrance(playerid, id);
forward OnPlayerHitHouseEntrance(playerid, hid);
//forward OnPlayerHitBusinessEntrance(playerid, bid);
